#include <stdio.h>
#include <stdlib.h>



int main(int argc,char ** argv)
{
	if(argc < 3)
	{
		fprintf(stderr,"Useage cpfile  <src_file>  <dist_file> \n");
		exit(1);
	}


	FILE *src = fopen(argv[1],"r");
	if(NULL == src)
	{
		perror("fopen() src");
		exit(1);
	}


	FILE *target = fopen(argv[2],"w+");
	if(NULL == target)
	{
		perror("fopen() target");
		fclose(src);
		exit(1);
	}


	int ch;
	while(1)
	{
		ch = fgetc(src);
		if(EOF == ch)
		{
			break;
		}
		fputc(ch,target);
	}


	fclose(target);
	fclose(src);

	return 0;
}





